package com.sufen.seckill.study.LeetCode;

import java.util.Deque;
import java.util.LinkedList;

/**
 * @Author sufen
 * @Date 2021/11/5 15:06
 * @Version 1.0
 * 功能描述：
 */
public class Offer_09_用两个栈实现队列 {


    Deque<Integer> stack1=new LinkedList<>();
    Deque<Integer> stack2=new LinkedList<>();


    public Offer_09_用两个栈实现队列(){

    }
    public void appendTail(int value){
        while(!stack1.isEmpty()){
            stack2.push(stack1.pop());
        }
        stack1.push(value);
        while(!stack2.isEmpty()){
            stack1.push(stack2.pop());
        }
    }
    public int deleteHead(){
        return stack1.pop();
    }
}